package com.lookme.lmtool.cracker.filter.color;

import com.jhlabs.image.GammaFilter;
import com.lookme.lmtool.cracker.CrackerConstants;
import com.lookme.lmtool.cracker.annotation.FilterAnnotation;
import com.lookme.lmtool.cracker.annotation.ParamAnnotation;
import com.lookme.lmtool.cracker.filter.AbstractFilter;
import com.thoughtworks.xstream.annotations.XStreamAsAttribute;

import java.awt.image.BufferedImageOp;

@FilterAnnotation(groupName = CrackerConstants.FILTER_GROUP_NAME_COLOR,name="伽码",filterClass = GammaFilter.class)
public class FilterGamma extends AbstractFilter {
    @XStreamAsAttribute
    @ParamAnnotation(name = "红色通道伽码值", desc = "红色通道伽码值",inputType = ParamAnnotation.InputType.Spinner,amountToStepBy = 0.1,max = 50,margin = {0,50,0,0})
    private float rGamma=1.0f;
    @XStreamAsAttribute
    @ParamAnnotation(name = "绿色通道伽码值", desc = "绿色通道伽码值",inputType = ParamAnnotation.InputType.Spinner,amountToStepBy = 0.1,max = 50,margin = {0,50,0,0})
    private float gGamma=1.0f;
    @XStreamAsAttribute
    @ParamAnnotation(name = "蓝色通道伽码值", desc = "蓝色通道伽码值",inputType = ParamAnnotation.InputType.Spinner,amountToStepBy = 0.1,max = 50,margin = {0,50,0,0})
    private float bGamma=1.0f;

    @Override
    public BufferedImageOp getFilter() {
        GammaFilter filter= new GammaFilter();
        filter.setGamma(rGamma,gGamma,bGamma);
        return filter;
    }
}
